﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using SilverChart.Core.Configuration;
using SilverChart.Core.Service;

namespace SilverChart.UnitTest.Core.Configuration {
    [ServiceProvider(LayzeCreation = true, Singleton = true, ServiceName = "Mocked Configuration Factory")]
    public class MockedConfigurationParserFactory : ConfigurationParserFactory{
        public const String MOCKED_CONFIGURATION_STRING = "Mocked_Configuration_String";

        #region ConfigurationParserFactory Members

        public bool IsCompatible(string ConfigString) {
            return ConfigString == MOCKED_CONFIGURATION_STRING;
        }

        public ConfigurationParser CreateParser(string ConfigString, string RootItemName) {
            MockedConfigurationParser mockedParser = new MockedConfigurationParser();
            Type rootType = ServiceManager.Instance.GetService<ConfigurationService>().GetRootConfiguratioItems("__ROOT__")[0];
            ConfigurationItem configItem = AbstractConfigurationItem.CreateInstance(rootType, mockedParser);
            mockedParser.Configuration = configItem;

            return mockedParser;
        }

        #endregion
    }
}
